<template>
	<view style="background-color: #F8F8F8;">
		<view class="nav-back">
			<top-heigth :backTitle="backTitle"></top-heigth>
		</view>	
		
		<view class="content-box">
			<view v-if="list.length == 0" class="kong-box">
				<uv-empty mode="" text="暂时没有消息通知~" icon="/static/image/kong-yao.png"></uv-empty>
			</view>
			<view class="notice2-list" v-for="item in list" v-else>
				<view class="notice-list-l">
					<view class=""><b>{{item.messageTitle}}</b></view>
					<view class="font-hui">{{item.createTime}}</view>
				</view>
				<view class="font">
					{{item.messageContent}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import TopHeigth from '@/components/TopHeigth.vue'
	
	export default {
		data() {
			return {
				backTitle:"消息通知",
				list: [],
				list2: [],
				userInfo: uni.getStorageSync('userInfo'),
			}
		},
		components: { TopHeigth },
		onLoad() {
			this.getList();
				this.getNowTime()
			// uni.setStorageSync('ismessagetime', (new Date()).toLocaleString());
		},
		methods: {
			getList(){
				uni.$u.http.post('/api/shop/v1_0/tAppMessageSendRCA/queryTAppMessageSend',{
					sendTypes:[0,1]
				}).then((res) => {
					this.list = res.aaData
				})
			},
			//获取当前时间
			     getNowTime() {
			       var date = new Date();
			       //年 getFullYear()：四位数字返回年份
			       var year = date.getFullYear(); //getFullYear()代替getYear()
			       //月 getMonth()：0 ~ 11
			       var month = date.getMonth() + 1;
			       //日 getDate()：(1 ~ 31)
			       var day = date.getDate();
			       //时 getHours()：(0 ~ 23)
			       var hour = date.getHours();
			       //分 getMinutes()： (0 ~ 59)
			       var minute = date.getMinutes();
			       //秒 getSeconds()：(0 ~ 59)
			       var second = date.getSeconds();
			       var time = year + '-' + this.addZero(month) + '-' + this.addZero(day) + ' ' + this.addZero(hour) + ":" +this.addZero(minute) + ':' + this.addZero(second);
									uni.setStorageSync('ismessagetime', time);
									console.log('用户点击取消',time);
			       },
			       //小于10的拼接上0字符串
			       addZero(s) {
			           return s < 10 ? ('0' + s) : s;
			       },
		}
	}
</script>

<style lang="scss" scoped>
	@mixin flex($direction: row) {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: $direction;
	}
	.uv-nav-slot {
		@include flex;
		align-items: center;
		justify-content: space-between;
		border-width: 0.5px;
		border-radius: 100px;
		border-color: #dadbde;
		padding: 3px 7px;
		opacity: 0.8;
	}
	
	.notice2-list{
		background-color: #fff;
		border-radius: 24rpx;
		padding: 32rpx 24rpx;
		margin-top: 24rpx;
		.notice-list-l{
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 30rpx;
			color: #333;
		}
		.font{
			color: #666;
			font-size: 26rpx;
			margin-top: 16rpx;
		}
	}
	
</style>
